# Define variables
CLASS_PATH = bin
JDK_PATH = C:\Program Files (x86)\Java\jdk1.7.0_45

# Create directories
dirs :
	mkdir -p obj
	mkdir -p lib

# Generate the headers
jni/lct_spri_AssetConverter.h : $(CLASS_PATH)/lct/spri/AssetConverter.class
	javah -classpath $(CLASS_PATH) -d jni lct.spri.AssetConverter

# Compile the objects
obj/lct_spri_AssetConverter.o : jni/lct_spri_AssetConverter.cpp jni/lct_spri_AssetConverter.h
	g++ -I"$(JDK_PATH)\include" -I"$(JDK_PATH)\include\win32" -c $< -o $@ -g	

# Link the library
lib/LifecycleSupport.dll : obj/lct_spri_AssetConverter.o
	g++ -Wl,--add-stdcall-alias -shared -static -o $@ $<
	
# General build
all : dirs lib lib/LifecycleSupport.dll

# General removal
clean :
	rm -r -f obj
	rm -r -f lib
	rm -f jni/lct_spri_AssetConverter.h